package com.zwan.oam_rtc.utils.messages;

import java.nio.ByteBuffer;

import com.zwan.oam_rtc.utils.wintcp.ByteTransfer;



public class SMSAck extends AbstractStruct {
    
//	callingnumber	varchar2(30)
//	callednumber	varchar2(30)
//	url	Varchar2(300)
//	SMSContent	Varchar2(500)

    private byte[] calling = new byte[30];
    private byte[] called = new byte[30];
    private byte[] url = new byte[300];
    private byte[] content = new byte[500];
    private static int LENGTH = 860;
    
    @Override
    public void writeToBuffer(ByteBuffer bf) {
        bf.put(calling);
        bf.put(called);
        bf.put(url);
        bf.put(content);
    }

    @Override
    public void readFromBuffer(ByteBuffer bf) {
        bf.get(calling);
        bf.get(called);
        bf.get(url);
        bf.get(content);
    }

    @Override
    public int getLength() {
        return LENGTH;
    }

    public String getCalling() {
        return ByteTransfer.getString(calling);
    }

    public void setCalling(String calling) {
        ByteTransfer.str2Byte(calling, this.calling);
    }

    public String getCalled() {
        return ByteTransfer.getString(called);
    }

    public void setCalled(String called) {
        ByteTransfer.str2Byte(called, this.called);
    }

    public String getUrl() {
        return ByteTransfer.getString(url);
    }

    public void setUrl(String url) {
        ByteTransfer.str2Byte(url, this.url);
    }

    public String getContent() {
        return ByteTransfer.getString(content);
    }

    public void setContent(String content) {
        ByteTransfer.str2Byte(content, this.content);
    }
    
    @Override
    public String toString(){
    	StringBuffer sb = new StringBuffer();
    	sb.append("SMS: calling=").append(calling)
    		.append("\ncalled=").append(called)
    		.append("\nurl=").append(url)
    		.append("\ncontent=").append(content);
    	return sb.toString();
    }
}
